package swing;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.Label;
import java.awt.Point;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.FlowLayout;

public class JLabelDemo1 extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					JLabelDemo1 frame = new JLabelDemo1();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public JLabelDemo1() {
		String picpath="C:\\Users\\Administrator\\Desktop\\217647a8bee7c88e9efb4a11cd2b34e6_175.jpg";
		File file=new File(picpath);
		InputStream input=null;
		byte b[] =new byte[(int)file.length()];
		try {
			input=new FileInputStream(file);
			input.read(b);
			input.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Icon icon=new ImageIcon(b);
		JLabel lab=null;
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		setTitle("welcome to MLDN");
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		 lab=new JLabel(icon,JLabel.CENTER);
		 lab.setBackground(Color.yellow);
		 lab.setForeground(Color.red);
		 JLabel la=new JLabel("mldn",JLabel.LEFT);
		Font fnt=new Font("serief", Font.ITALIC+Font.BOLD, 28);
		la.setFont(fnt);
		la.setForeground(Color.red);
		contentPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
		contentPane.add(lab);
		contentPane.add(la);
		contentPane.setBackground(Color.white);
		Point point =new Point(300, 200);
		contentPane.setLocation(point);
		contentPane.setVisible(true);
		
	}

}
